home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / infoserv / www / cern / dev / scott.Z / scott / WWW / NextStep / Implementation / HyperAccess.m < prev    next >
Encoding:
Text File  |  1993-02-01  |  2.8 KB  |  162 lines

  1. //                                HyperAccess.m
  2.  
  3. //    A HyperAccess object provides access to hyperinformation, using
  4. //    particular protocols and data format transformations.
  5. //    This actual class will not work itself: it just contains common code.
  6.  
  7. // History:
  8. //    26 Sep 90    Written TBL
  9.  
  10. // Implements:
  11. #import "HyperAccess.h"
  12.  
  13. // Uses:
  14. #include <stdio.h>
  15. #include <appkit/appkit.h>
  16. #import "HyperManager.h"
  17. #import "HTAnchor.h"
  18. #import "HTUtils.h"
  19.  
  20. @implementation HyperAccess
  21.  
  22. //    Methods used by the Interface Builder code to connect up the application:
  23. - setTitleString:anObject
  24. {
  25.     titleString = anObject;
  26.     return self;
  27. }
  28.  
  29. - setAddressString:anObject
  30. {
  31.     addressString = anObject;
  32.     return self;
  33. }
  34.  
  35. - setOpenString:anObject
  36. {
  37.     openString = anObject;
  38.     return self;
  39. }
  40.  
  41. - setKeywords:anObject
  42. {
  43.     keywords = anObject;
  44.     return self;
  45. }
  46.  
  47. - setContentSearch:anObject
  48. {
  49.     contentSearch = anObject;
  50.     return self;
  51. }
  52.  
  53.  
  54. //    Methods to return the values of instance variables
  55.  
  56. //    Return the name of this access method
  57.  
  58. - (const char *)name
  59. {
  60.     return "Generic";
  61. }
  62.  
  63.  
  64. //        Actions:
  65.  
  66. //    These are all dummies, because only subclasses of this class actually work.
  67.  
  68. - search:sender
  69. {
  70.     return nil;
  71. }
  72.  
  73. - searchRTF:sender
  74. {
  75.     return nil;
  76. }
  77.  
  78. - searchSGML:sender
  79. {
  80.     return nil;
  81. }
  82.  
  83. //    Direct open buttons:
  84.  
  85. - open:sender
  86. {
  87.     return nil;
  88. }
  89.  
  90. - openRTF:sender
  91. {
  92.     return nil;
  93. }
  94.  
  95. - openSGML:sender
  96. {
  97.     return nil;
  98. }
  99. - accessName:(const char *)name Diagnostic:(int)level
  100. {
  101.     return nil;        /* can't do that. */
  102. }
  103.  
  104. //    This will load an anchor which has a name
  105.  
  106. - loadAnchor: (HTAnchor *) anAnchor
  107. {
  108.     return [self loadAnchor:anAnchor Diagnostic:0];    // If not otherwise implemented
  109. }
  110.  
  111. - loadAnchor: (HTAnchor *)a Diagnostic:(int)diagnostic
  112. {
  113.     return nil;    
  114. }
  115.  
  116. - saveNode:(HyperText *)aText
  117. {
  118.     NXRunAlertPanel(NULL,
  119. "You cannot overwrite this original document. You can use `save a copy in...'",
  120.             NULL,NULL,NULL);
  121.     printf(
  122.     "HyperAccess: You cannot save a hypertext document in this domain.\n");
  123.     return nil;
  124. }
  125.  
  126.  
  127. //    Text Delegate methods
  128. //    ---------------------
  129. //    These default methods for an access allow editing, and change the cross
  130. //    in the window close button to a broken one if the text changes.
  131.  
  132. #ifdef TEXTISEMPTY
  133. //    Called whenever the text is changed
  134. - text:thatText isEmpty:flag
  135. {
  136.     if (TRACE) printf("Text %i changed, length=%i\n", thatText, [thatText textLength]);
  137.     return self;
  138. }
  139. #endif
  140.  
  141. - textDidChange:textObject
  142. {
  143.     if (TRACE) printf("HM: text Did Change.\n");
  144.     [[textObject window] setDocEdited:YES];    /* Broken cross in close button */
  145.     return self;
  146. }
  147.  
  148. - (BOOL)textWillChange:textObject
  149. {
  150.     if (TRACE) printf("HM: text Will Change -- OK\n");
  151.     return NO;            /* Ok - you may change (sic) */
  152. }
  153.  
  154.  
  155. //    These delegate methods are special to HyperText:
  156.  
  157. - hyperTextDidBecomeMain: sender
  158. {
  159.     return [TheManager hyperTextDidBecomeMain: sender];
  160. }
  161. @end
  162.